<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBeanMarketPurchasesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('bean_market_purchases', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->timestamp('purchase_date')->comment('购买日期');
            $table->decimal('beans_purchased', 18, 6)->default(0)->comment('购买KC通证');
            $table->decimal('unit_price', 18, 6)->default(0)->comment('KC通证单价');
            $table->decimal('total_amount', 18, 6)->default(0)->comment('总额');
            $table->tinyInteger('user_level')->comment('购买时用户等级');
            $table->decimal('daily_limit', 18, 6)->default(0)->comment('当日购买限额');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `bean_market_purchases` comment '交易大厅KC通证购买记录'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('bean_market_purchases');
    }
}
